<?php

class IndexAdvertisement extends CWidget
{
	public $index=false;
	public function run() 
	{
		if ($this->index==true)
		{
			$AdvB = Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>true,':flag'=>true,':type'=>'big'));
			$AdvM=Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>true,':flag'=>true,':type'=>'midl'));
			$AdvS=Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>true,':flag'=>true,':type'=>'small'));
		}
		else 
		{
			$AdvB = Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>false,':flag'=>true,':type'=>'big'));
			$AdvM=Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>false,':flag'=>true,':type'=>'midl'));
			$AdvS=Advertisement::model()->findAll("indexf=:indexf AND flag=:flag AND type=:type",array(':indexf'=>false,':flag'=>true,':type'=>'small'));
			
		}	
		
		
		$this->render('indexad',array('advB'=>$AdvB,'advM'=>$AdvM,'advS'=>$AdvS));
	}
}

?>